<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Dashboard Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="/web/libs/bootstrap/4.0/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="/web/libs/bootstrap/4.0/css/dashboard.css" rel="stylesheet">
    <link href="/web/libs/bootstrap/4.0/css/bootstrap-table.min.css" rel="stylesheet">
    <link href="/web/libs/bootstrap/4.0/css/bootstrap-table-fixed-columns.min.css" rel="stylesheet">
</head>

<body>
<div id="header"></div>
<div class="container-fluid">
    <div class="row">
        <div id="menu"></div>
        <main class="col-sm-9 offset-sm-3 col-md-10 offset-md-2 pt-3">
            <div class="container">
                <div class="input-group">
                    查询日期：<input type="text" class="form-control" id="queryDate" value="20200202">
                    开始日期：<input type="text" class="form-control" id="startDate" value="20190101">
                    结束日期：<input type="text" class="form-control" id="endDate" value="20200201">
                    code:<input type="text" class="form-control" id="code" value="">
                    强制执行：<input type="checkbox" class="form-control" id="forceJob" value="false">
                </div>
                <div class="input-group">
                    开始阶段天数：<input type="text" class="form-control" id="startStepDays" value="85">
                    开始涨停数：<input type="text" class="form-control" id="startStepFullLimitCount" value="1">
                    开始上涨：<input type="text" class="form-control" id="startStepRange" value="50">%
                    水平平均拆分N值：<input type="text" class="form-control" id="calculateAvgCountN" value="10">
                    水平250线上比例：<input type="text" class="form-control" id="moreThanMa250Range" value="80">%
                    最近N%的量：<input type="text" class="form-control" id="near7daysRange" value="10">
                </div>
                <div class="input-group">
                    水平跌幅范围：<input type="text" class="form-control" id="avgNDownRange" value="-15">%
                    不允许跌幅超过量 ：<input type="text" class="form-control" id="avgNDownRMoreExcludeCount" value="2">
                    水平涨幅范围：<input type="text" class="form-control" id="avgNUpRange" value="15">%
                    必须涨幅超过量 ：<input type="text" class="form-control" id="avgNUpRMoreExcludeCount" value="10">
                    排序包含250线：<input type="checkbox" checked="checked" class="form-control" id="sortBy250" value="true">
                </div>
                <div class="input-group">
                    开始最高价与水平最低价范围：<input type="text" class="form-control" id="topToNDownRange" value="35">
                    概念关键字：<input type="text" class="form-control" id="conceptName" value="">
                    <span lass="input-group-btn"> <button class="btn btn-default" type="button" id="queryAction">Go!</button> </span>
                    <span lass="input-group-btn"> <button class="btn btn-default" type="button" id="downAction">Download!</button> </span>
                </div>
            </div>

            <div id="rptList" style="width: 100%; hight: 100%; float: left；">
                <table class="table table-hover" id="cusTable">
                </table>
            </div>
        </main>
    </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/web/libs/js/jquery-3.1.1.slim.min.js"
        integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n"
        crossorigin="anonymous"></script>
<script src="/web/libs/js/tether.min.js"
        integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb"
        crossorigin="anonymous"></script>
<script src="/web/libs/bootstrap/4.0/js/bootstrap.min.js"></script>
<script src="/web/libs/js/common.js"></script>
<script src="/web/libs/js/jquery.js"></script>
<script src="/web/libs/js/dashboard/index.js"></script>
<script src="/web/libs/bootstrap/4.0/js/bootstrap-table.js"></script>
<script src="/web/libs/js/dashboard/basedata.js"></script>
<script src="/web/libs/js/bootstrap-table-fixed-columns.min.js"></script>
<script type="text/javascript">
    $("#header").load("/web/header.html")
    addActive("m_horizontal");
    $('#cusTable').bootstrapTable('destroy');
    $('#queryDate').val(new Date().format("yyyyMMdd"));
    $('#endDate').val(new Date().format("yyyyMMdd"));

    function loadData() {
        $('#cusTable').bootstrapTable('destroy');
        $("#cusTable").bootstrapTable(
            {
                method: "get", //使用get请求到服务器获取数据
                url: "/web/horizontal/horizontalRange", //获取数据的Servlet地址
                striped: true, //表格显示条纹
                pagination: true, //启动分页
                cache: false,
                pageSize: 500, //每页显示的记录数
                //pageNumber:1, //当前第几页
                pageList: [10, 150, 500, 500], //记录数可选列表
                search: false, //是否启用查询
                sortable: true,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
                //showColumns: true,  //显示下拉框勾选要显示的列
                //showRefresh: true,  //显示刷新按钮
                sidePagination: "server", //表示服务端请求
                //设置为undefined可以获取pageNumber，pageSize，searchText，sortName，sortOrder
                //设置为limit可以获取limit, offset, search, sort, order
                queryParamsType: "undefined",
                queryParams: function queryParams(params) { //设置查询参数
                    var queryDate = $('#queryDate').val();
                    var startDate = $('#startDate').val();
                    var endDate = $('#endDate').val();
                    var code = $('#code').val();
                    var forceJob = $('#forceJob').is(":checked");
                    var startStepDays = $('#startStepDays').val();
                    var startStepFullLimitCount = $('#startStepFullLimitCount').val();
                    var startStepRange = $('#startStepRange').val();
                    var calculateAvgCountN = $('#calculateAvgCountN').val();
                    var moreThanMa250Range = $('#moreThanMa250Range').val();
                    var near7daysRange = $('#near7daysRange').val();
                    var avgNDownRange = $('#avgNDownRange').val();
                    var avgNDownRMoreExcludeCount = $('#avgNDownRMoreExcludeCount').val();
                    var avgNUpRange = $('#avgNUpRange').val();
                    var avgNUpRMoreExcludeCount = $('#avgNUpRMoreExcludeCount').val();
                    var sortBy250 = $('#sortBy250').is(":checked");
                    var topToNDownRange = $('#topToNDownRange').val();
                    var conceptName = $('#conceptName').val();

                    var param = {
                        pageNum: params.pageNumber,
                        pageSize: params.pageSize,
                        sortName: params.sortName,      //排序列名
                        sortOrder: params.sortOrder //排位命令（desc，asc）
                    };
                    param.queryDate = queryDate;
                    param.startDate = startDate;
                    param.endDate = endDate;
                    param.code = code;
                    param.forceJob = forceJob;
                    param.startStepDays = startStepDays;
                    param.startStepFullLimitCount = startStepFullLimitCount;
                    param.startStepRange = startStepRange;
                    param.calculateAvgCountN = calculateAvgCountN;
                    param.moreThanMa250Range = moreThanMa250Range;
                    param.near7daysRange = near7daysRange;
                    param.avgNDownRange = avgNDownRange;
                    param.avgNDownRMoreExcludeCount = avgNDownRMoreExcludeCount;
                    param.avgNUpRange = avgNUpRange;
                    param.avgNUpRMoreExcludeCount = avgNUpRMoreExcludeCount;
                    param.sortBy250 = sortBy250;
                    param.topToNDownRange = topToNDownRange;
                    param.conceptName = conceptName;
                    return param;
                },
                columns: [{
                    field: 'code',
                    title: '股票代码',
                }, {
                    field: 'name',
                    title: '名称',
                }, {
                    field: 'queryDate',
                    title: '查询时间',
                }, {
                    field: 'moreThanMa250Count',
                    title: '超过250日线的量',
                    sortable: true,
                }, {
                    field: 'pre1ConformCount',
                    title: '倒数1天',
                    sortable: true,
                }, {
                    field: 'pre2ConformCount',
                    title: '倒数2天',
                    sortable: true,
                }, {
                    field: 'pre3ConformCount',
                    title: '倒数3天',
                    sortable: true,
                }, {
                    field: 'pre4ConformCount',
                    title: '倒数4天',
                    sortable: true,
                }, {
                    field: 'pre5ConformCount',
                    title: '倒数5天',
                    sortable: true,
                }, {
                    field: 'pre6ConformCount',
                    title: '倒数6天',
                    sortable: true,
                }, {
                    field: 'pre7ConformCount',
                    title: '倒数7天',
                    sortable: true,
                }, {
                    field: 'incrementCount',
                    title: '上涨天数',
                    sortable: true,
                }, {
                    field: 'conceptName',
                    title: '相关概念',
                }, {
                    field: 'czxbj_pm',
                    title: '成长性比较排名',
                }, {
                    field: 'czxbj_jbmgsyzzlfh',
                    title: '成长性比较3年复合',
                }, {
                    field: 'gzbj_pm',
                    title: '估值比较排名',
                }, {
                    field: 'gzbj_peg',
                    title: '估值比较ROE',
                }, {
                    field: 'dbfxbj_pm',
                    title: '杜邦分析比较排名',
                }, {
                    field: 'dbfxbj_roepj',
                    title: '杜邦分析比较ROE(%)',
                }, {
                    field: 'gsgmzsz_pm',
                    title: '公司规模排名',
                }, {
                    field: 'gsgmzsz_zsz',
                    title: '公司规模总市值(元)',
                }],
                fixedColumns: true,
                fixedNumber: +2,
                fixedRightNumber: +2,
                responseHandler: function responseHandler(res) {

                    var s1 = JSON.stringify(res.result);
                    var s2 = '{"total":9999,"rows":' + s1 + '}';
                    //alert(s2);
                    return eval('(' + s2 + ')')
                },
                onLoadSuccess: function () { //加载成功时执行
                    $("#rptList").show();
                },
                onLoadError: function () { //加载失败时执行
                    alert("加载数据失败");
                }
            });
    }

    $("#queryAction").click(function () {
        //alert("abc");
        loadData()
    });
    $("#downAction").click(function () {
        window.location.href = "/web/horizontal/download?queryDate=" + $('#queryDate').val() +
            "&startDate=" + $('#startDate').val() +
            "&endDate=" + $('#endDate').val() +
            "&code=" + $('#code').val() +
            "&forceJob=" + $('#forceJob').is(":checked") +
            "&startStepDays=" + $('#startStepDays').val() +
            "&startStepFullLimitCount=" + $('#startStepFullLimitCount').val() +
            "&startStepRange=" + $('#startStepRange').val() +
            "&calculateAvgCountN=" + $('#calculateAvgCountN').val() +
            "&moreThanMa250Range=" + $('#moreThanMa250Range').val() +
            "&near7daysRange=" + $('#near7daysRange').val() +
            "&avgNDownRange=" + $('#avgNDownRange').val() +
            "&avgNDownRMoreExcludeCount=" + $('#avgNDownRMoreExcludeCount').val() +
            "&avgNUpRange=" + $('#avgNUpRange').val() +
            "&avgNUpRMoreExcludeCount=" + $('#avgNUpRMoreExcludeCount').val() +
            "&sortBy250=" + $('#sortBy250').is(":checked") +
            "&topToNDownRange=" + $('#topToNDownRange').val() +
            "&conceptName=" + $('#conceptName').val();
    });
    loadData();
</script>
</body>
</html>
